#ifndef __DEF_EXPENSEDIALOG_H__
#define __DEF_EXPENSEDIALOG_H__

#include <wx/wx.h>
#include <wx/bmpcbox.h>
#include "appconstant.h"
#include "dbkakeibo.h"
#include "it_dialog.h"
#include <vector>

class ExpenseDialog: public wxDialog
{
public:
	ExpenseDialog(wxWindow *parent);
	~ExpenseDialog(void);
	
	void BindData_Expense(wxSQLite3ResultSet &table);
	void BindData_Items(wxSQLite3ResultSet &table);
	void BindData_Icon(wxImageList *list);
	std::vector<DB_expense> GetChangedExpense(modifyType mt = none_mt);
	std::vector<DB_items> GetChangedItems(modifyType mt = none_mt);
	void ClearControl(void) {
		ed_InputExpenseName->Clear();
		ed_IOtype->SetSelection(0);
	}
protected:
	wxListBox *ed_ExpenseList;
	wxButton *ed_AddExpense;
	wxButton *ed_ModExpense;
	wxButton *ed_DelExpense;
	wxStaticBox *ed_ExpenseInfo;
		wxTextCtrl *ed_InputExpenseName;
		wxButton *ed_SettingItemsBtn;
		wxBitmapComboBox *ed_ExpenseImage;
	wxRadioBox *ed_IOtype;
	
	wxButton *ed_OkBtn;
	wxButton *ed_CanBtn;
	
	ItemsDialog *it_dialog;

	void ed_AddExpense_clicked(wxCommandEvent &event);
	void ed_ModExpense_clicked(wxCommandEvent &event);
	void ed_DelExpense_clicked(wxCommandEvent &event);
	void ed_ExpenseList_selected(wxCommandEvent &event);
	void ed_IOtype_selected(wxCommandEvent &event);
	void ed_SettingItemsBtn_clicked(wxCommandEvent &event);

	void ed_OkBtn_clicked(wxCommandEvent &event);
	void ed_CanBtn_clicked(wxCommandEvent &event);

	void ShowExpense(InoutType io);
private:
	DECLARE_EVENT_TABLE()

	std::vector<DB_expense> dbexpense;
	std::vector<DB_items> dbitems;
	std::vector<int> dbexpenseId;
	int in_expense;
	int out_expense;
	int maxexpenseId;
	std::vector<int> maxitemsId;
};

enum {
	expense_ok = 100,
	expense_can,
	expense_add,
	expense_mod,
	expense_del,
	expense_list,
	expense_iobox,
	expense_setitems

};

#endif